package com.myhome.controller;

import com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition;
import com.alibaba.csp.sentinel.adapter.gateway.common.api.GatewayApiDefinitionManager;
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule;
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @Author QYiXin
 * @Date 2021 10 03 14 28
 **/
@RestController
public class GatewayFlowRulesController {
    @GetMapping("/gw/flow/rules")
    public Set<GatewayFlowRule> getGatewayFlowRule() {
        return GatewayRuleManager.getRules();
    }

    @GetMapping("/gw/api/groups")
    public Set<ApiDefinition> getApiDefinition(){
        return GatewayApiDefinitionManager.getApiDefinitions();
    }
}
